import { httpClient } from '@/utils/http/axios';
import { ErrorMessageMode } from '#/axios';
import { AjaxResult } from '@/api/model';
import { PageRequest, PageData } from '@/utils/common/types';
import { SettingInputDto, SettingOutputDto } from './setting.data';

enum Api {
  Get = '/api/Admin/Setting/Get',
  Save = '/api/Admin/Setting/Save',
}

export function Get(mode: ErrorMessageMode = 'message') {
  return httpClient.post<AjaxResult>(
    {
      url: Api.Get,
      params: {},
    },
    {
      errorMessageMode: mode,
    },
  );
}

export function Save(dtos: SettingInputDto[], mode: ErrorMessageMode = 'message') {
  return httpClient.post<AjaxResult>(
    {
      url: Api.Save,
      params: dtos,
    },
    {
      errorMessageMode: mode,
    },
  );
}
